package com.tensquare.article.exception;

import com.tensquare.entity.Result;
import com.tensquare.entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: xxx
 * @Date: 2022/10/22 20:00
 * @Description: 异常
 */
//@ControllerAdvice
public class BaseExceptionHandler {
    
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result ExceptionHandler(Exception e){
        System.out.println("处理异常");
        return new Result(false, StatusCode.ERROR,"有异常，请联系管理员",e.getMessage());
    }
}
